import request, { upload } from "@/utils/request";

// 发送群聊消息
export function sendGroupMsg(type, id, data) {
    return request({
        url: `/im/sendGroupMessage/${type}/${id}`,
        method: "post",
        data: data,
    });
}

// 获取群聊聊天记录
export function getGroupMsg(type, id, taskId, timestamp) {
    return request({
        url: `/im/getGroupMessageList/${type}/${id}/${taskId}/${timestamp}`,
        method: "get",
    });
}

/**
 * 获取所有群组聊天记录
 * @param {*} type 群组类型，演练（drill）或者救援（handle）
 * @param {*} id 群组ID
 * @returns
 */
export function getAllGroupMsg(type, id) {
    return request({
        url: `/im/getAllGroupMessageList/${type}/${id}`,
        method: "get",
    });
}

// 上传附件
export function uploadFile(file, data) {
    return upload("/im/upload", file, data);
}
